package com.etoak.web.sys_user.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Date;

/**
 * @Author by 孙有泽
 * @Date 2025/2/18 12:44
 * @Description
 */
@TableName("user")
@Data
public class SysUser implements UserDetails {
    @TableId(type = IdType.AUTO)
    private String id;
    private String username;
    private String password;
    private String phone;
    private String email;

    private String gender;

    private String nickname;

    @TableField(fill = FieldFill.INSERT,value ="createTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    @TableField(fill = FieldFill.UPDATE,value ="updateTime")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date updateTime;

    @TableLogic(value = "0",delval = "1")
    private Integer deleted=0;

    private Integer isadmin;

    @TableField(exist = false)
    private String roleId;

    private boolean isAccountNonExpired=true;
    private boolean isAccountNonLocked=true;
    private boolean isCredentialsNonExpired=true;
    private boolean isEnabled=true;
    @TableField(exist = false)
    Collection<? extends GrantedAuthority> authorities;

}
